function validate_login_form()
{
 var email = document.getElementsByName("email")[0].value;
 var password = document.getElementsByName("password")[0].value;
 

  if( email == "")
   {
     document.getElementsByClassName("required")[0].innerHTML = "<font color=red>* Must not be empty</font>";
   }
  if( password == "")
   {
     document.getElementsByClassName("required")[1].innerHTML = "<font color=red>* Must not be empty</font>";
   }
   if( email != "")
   {
     var atpos = email.indexOf("@");
     var dotpos = email.lastIndexOf(".");
     if (atpos < 1 || dotpos < atpos+2 || dotpos+2 >= email.length)
      {
       document.getElementsByClassName("required")[0].innerHTML = "<font color=red>* Invalid e_mail</font>";
      }
      else
      {
        document.getElementsByClassName("required")[0].innerHTML = "";
      }
   }
 if( password != "")
   {
     document.getElementsByClassName("required")[1].innerHTML = "";
   }
   submit();
}

function submit ()
{
  var required = document.getElementsByClassName("last_check");
  var check = true;

 for ( var i =0 ; i < required.length ; i++)
  {
    if (required[i].innerHTML != "") 
    {
     check = false;
    }
  }
  if (check)
  {
    var submit_button =document.getElementById("submit")
    submit_button.type = "submit";
  }

}